package com.itboye.eweilisten.presenter;


import com.itboye.eweilisten.interfaces.IUserInfoInterface;
import com.itboye.eweilisten.me.personal.model.PersonDataBean;
import com.itboye.eweilisten.model.Homebean;
import com.itboye.eweilisten.responsitory.UserResponsitory;
import com.itboye.eweilisten.volley.BasePresenter;
import com.itboye.eweilisten.volley.ICompleteListener;
import com.itboye.eweilisten.volley.ResultEntity;

import java.util.Observer;


/**
 * Created by admin on 2016/11/28.
 */

public class UserPresenter extends BasePresenter implements
        IUserInfoInterface<PersonDataBean> {
    // 用户登录
    public static final String login_success = UserPresenter.class.getName()
            + "_User_success";
    public static final String login_fail = UserPresenter.class.getName()
            + "_User_fail";

    //注册
    public static final String register_success = UserPresenter.class.getName()
            + "_Register_success";
    public static final String register_fail = UserPresenter.class.getName()
            + "_Register_fail";

    //发送验证码
    public static String send_code_fail = "_Send_code_fail";
    public static String send_code_success = "_Send_code_success";
    //验证验证码
    public static String yanzheng_code_fail = "_yanzheng_code_fail";
    public static String yanzheng_code_success = "_yanzheng_code_success";


    //调查问卷
    public static String Diaocha_fail = "_Diaocha_fail";
    public static String Diaocha_success = "_Diaocha_success";

    //提交问卷
    public static String Tijiao_fail = "_Tijiao_fail";
    public static String Tijiao_success = "_Tijiao_success";

    //修改密码
    public static String WangJiMiMa_fail = "_WangJiMiMa_fail";
    public static String WangJiMiMa_success = "_WangJiMiMa_success";

    //修改邮箱地址
    public static String Update_Emeal_fail = "_Update_Emeal_fail";
    public static String Update_Emeal_success = "_Update_Emeal_success";

    //获取学校
    public static String School_fail = "_School_fail";
    public static String School_success = "_School_success";

    //更新资料
    public static String Dtree_fail = "_Dtree_fail";
    public static String Dtree_success = "_Dtree_success";


    //头像
    public static String HEAD_fail = "_HEAD_fail";
    public static String HEAD_success = "_HEAD_success";


    //资料更新
    public static String Update_fail = "_Update_fail";
    public static String Update_success = "_Update_success";


    //自动登录
    public static String ZiDong_fail = "_ZiDong_fail";
    public static String ZiDong_success = "_ZiDong_success";

    //查询设备
    public static String Device_fail = "_Device_fail";
    public static String Device_success = "_Device_success";

    //shanchu设备
    public static String DeleteDevice_fail = "_DeleteDevice_fail";
    public static String DeleteDevice_success = "_DeleteDevice_success";
    //个人中心修改密码
    public static String UpdatePwd_fail = "_UpdatePwd_fail";
    public static String UpdatePwd_success = "_UpdatePwd_success";

    //首页
    public static String Home_fail = "_Home_fail";
    public static String Home_success = "_Home_success";

    //商品详情
    public static String Goods_fail = "_Goods_fail";
    public static String Goods_success = "_Goods_success";

    //商品详情
    public static String GoodsList_fail = "_GoodsList_fail";
    public static String GoodsList_success = "_GoodsList_success";
    //立即支付
    public static String Plilay_fail = "_Plilay_fail";
    public static String Plilay_success = "_Plilay_success";

    //重新支付
    public static String chongxin_Plilay_success = "_chongxin_Plilay_success";
    public static String chongxin_Plilay_fail = "_chongxin_Plilay_fail";


    //我的订单
    public static String Order_fail = "_Order_fail";
    public static String Order_success = "_Order_success";

    //取消订单
    public static String CanlerOrder_fail = "_CanlerOrder_fail";
    public static String CanlerOrder_success = "_CanlerOrder_success";

    //跟换手机号码
    public static String UpdatePhone_fail = "_UpdatePhone_fail";
    public static String UpdatePhone_success = "_UpdatePhone_success";

    //订单详情
    public static String OrderDetalis_fail = "_OrderDetalis_fail";
    public static String OrderDetalis_success = "_OrderDetalis_success";

    //我的书籍
    public static String MyBooks_fail = "_ MyBooks_fail";
    public static String MyBooks_success = "_ MyBooks_success";


    //TextABean
    public static String TextA_fail = "_ TextA_fail";
    public static String TextA_success = "_ TextA_success";


    //TextABean
    public static String SchoolRepor_fail = "_ SchoolRepor_fail";
    public static String SchoolRepor_success = "_ SchoolRepor_success";

    /***
     * 错题不
     */
    public static String SchoolReporTwo_fail = "_ SchoolReporTwo_fail";
    public static String SchoolReporTwo_success = "_ SchoolReporTwo_success";

    public static String SouSuo_fail = "_ SouSuo_fail";
    public static String SouSuo_success = "_ SouSuo_success";

    public static String SubmitDetail_fail = "_SubmitDetail_fail";
    public static String SubmitDetail_success = "_ SubmitDetail_success";

    //删除答题
    public static String delete_success = "_delete_success";
    public static String delete_fail = "_delete_fail";

    //删除答题
    public static String weixin_pay_success = "_weixin_pay_success";
    public static String weixin_pay_fail = "_weixin_pay_fail";

    //已购书籍
    public static String yigou_book_success = "_yigou_book_success";
    public static String yigou_book_fail = "_yigou_book_fail";

    //猜你喜欢
    public static String guess_like_success="_guess_like_success";
    public static String guess_like_fail="_guess_like_fail";

    public UserPresenter(Observer observer) {
        super(observer);
    }

    @Override
    public void login(String username, String pwd) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(login_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(login_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.login(username, pwd);
    }

    @Override
    public void onRefister(String code, String mobile, String username, String password) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(register_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(register_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onRefister(code, mobile, username, password);
    }


    @Override
    public void onSecurCode(String acceptor, String code_type) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(send_code_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(send_code_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onSecurCode(acceptor, code_type);
    }

    @Override
    public void onDiaocha(String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Diaocha_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Diaocha_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onDiaocha(uid,s_id);
    }

    @Override
    public void onTiJiaoWenJuan(String answer,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Tijiao_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Tijiao_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onTiJiaoWenJuan(answer,uid,s_id);
    }

    @Override
    public void onYanZhengMa(String acceptor, String code, String code_type,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(yanzheng_code_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(yanzheng_code_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onYanZhengMa(acceptor, code, code_type,uid,s_id);
    }

    @Override
    public void onPassWord(String s_id, String code, String email, String password,String uid) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(WangJiMiMa_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(WangJiMiMa_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onPassWord(s_id, code, email, password,uid);
    }

    @Override
    public void onUpdateemil(String email, String new_email, String code,String new_code,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Update_Emeal_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Update_Emeal_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onUpdateemil(email, new_email, code,new_code,uid,s_id);
    }

    @Override
    public void onSchool(String area_id,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(School_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(School_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onSchool(area_id,uid,s_id);
    }

    /**
     * 更新资料
     */
    @Override
    public void onQuestion(String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Dtree_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Dtree_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onQuestion(uid,s_id);
    }

    @Override
    public void onHeadQuestion(String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(HEAD_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(HEAD_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onHeadQuestion(uid,s_id);
    }

    @Override
    public void onUpdateUser(String s_id, String uid, String nickname, String sex, String sign, String head, String grade_code, String loc_school, String loc_country, String loc_area) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Update_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Update_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onUpdateUser(s_id, uid, nickname, sex, sign, head, grade_code, loc_school, loc_country, loc_area);
    }

    @Override
    public void onAutoLogin(String uid, String auto_login_code) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(ZiDong_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(ZiDong_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onAutoLogin(uid, auto_login_code);
    }

    @Override
    public void onDevice(String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Device_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Device_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onDevice(uid,s_id);
    }

    @Override
    public void onDeleteDevice(String s_id, String uid, String device_token) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(DeleteDevice_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(DeleteDevice_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onDeleteDevice(s_id, uid, device_token);
    }

    @Override
    public void onHomeLunbo(String size,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Home_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Home_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onHomeLunbo(size,uid,s_id);
    }

    @Override
    public void onUpdatePwd(String s_id, String uid, String password, String new_password) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(UpdatePwd_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(UpdatePwd_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onUpdatePwd(s_id, uid, password, new_password);
    }

    @Override
    public void onGoodsInfo(String id,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Goods_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Goods_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onGoodsInfo(id,uid,s_id);
    }

    @Override
    public void onGoodsInfoLie(String id, String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(GoodsList_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(GoodsList_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onGoodsInfoLie(id, uid,s_id);
    }

    @Override
    public void onPlipay(String idcode, String s_id, String uid, String sku_pkid, String note) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Plilay_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Plilay_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onPlipay(idcode, s_id, uid, sku_pkid, note);
    }

    @Override
    public void chongxinPlipay(String s_id, String uid, String order_code) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(chongxin_Plilay_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(chongxin_Plilay_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.chongxinPlipay(s_id, uid, order_code);
    }

    @Override
    public void onWeiXinPay(String pay_code,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(weixin_pay_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }
                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(weixin_pay_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }
                });
        user.onWeiXinPay(pay_code,uid,s_id);
    }

    @Override
    public void onOrder(String s_id, String uid, String keyword, String query_status, String page_index, String page_size) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Order_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Order_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onOrder(s_id, uid, keyword, query_status, page_index, page_size);
    }

    @Override
    public void onCanlerOrder(String s_id, String uid, String order_code) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(CanlerOrder_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(CanlerOrder_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onCanlerOrder(s_id, uid, order_code);
    }

    @Override
    public void onUpdatePhone(String s_id, String uid, String mobile, String mobile_new) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(UpdatePhone_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(UpdatePhone_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onUpdatePhone(s_id, uid, mobile, mobile_new);
    }

    @Override
    public void onOrderDetails(String s_id, String uid, String orderNum) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(OrderDetalis_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(OrderDetalis_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onOrderDetails(s_id, uid, orderNum);
    }

    @Override
    public void onMyBooks(String uid, String pageNum, String pageSize,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(MyBooks_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(MyBooks_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onMyBooks(uid, pageNum, pageSize,s_id);
    }

    @Override
    public void onTimu(String uid, String unit_id, String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(TextA_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(TextA_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onTimu(uid, unit_id, s_id);
    }

    @Override
    public void onSchoolRepor(String uid, String answer_type, String book_id, String unit_id, String order, String current_page, String page_size,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SchoolRepor_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SchoolRepor_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onSchoolRepor(uid, answer_type, book_id, unit_id, order, current_page, page_size,s_id);
    }

    @Override
    public void onSchoolReporTwo(String uid, String answer_type, String book_id, String unit_id, String order, String current_page, String page_size,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SchoolReporTwo_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SchoolReporTwo_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onSchoolRepor(uid, answer_type, book_id, unit_id, order, current_page, page_size,s_id);
    }

    @Override
    public void onPreSearch(String uid, String kword, String book_id, String page_size,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SouSuo_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SouSuo_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onPreSearch(uid, kword, book_id, page_size,s_id);
    }

    @Override
    public void onSubmitDetail(String uid, String unit_id,String id,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SubmitDetail_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SubmitDetail_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);

                    }
                });
        user.onSubmitDetail(uid, unit_id,id,s_id);
    }

    @Override
    public void onDelet(String uid, String id,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(delete_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(delete_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }
                });
        user.onDelet(uid, id,s_id);
    }

    @Override
    public void onYiMaiBook(String uid, String kword, String cate_id, String page_index, String page_size,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(yigou_book_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(yigou_book_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }
                });
        user.onYiMaiBook(uid, kword,cate_id,page_index,page_size,s_id);
    }

    @Override
    public void onGuessLike(String size, String page, String group,String uid,String s_id) {
        IUserInfoInterface<PersonDataBean> user = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(guess_like_success);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(guess_like_fail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }
                });
        user.onGuessLike(size, page, group,uid,s_id);
    }

}
